package com.xh.bussiness.classinteractive.controller;

import com.xh.bussiness.classinteractive.bean.QueryClassInteractiveCommonRequest;
import com.xh.bussiness.classinteractive.model.ClassInteractiveCommon;
import com.xh.bussiness.classinteractive.model.ClassInteractiveCommonIcon;
import com.xh.bussiness.classinteractive.service.ClassInteractiveCommonIconService;
import com.xh.bussiness.classinteractive.service.ClassInteractiveCommonService;
import com.xh.core.bean.AjaxResult;
import com.xh.core.bean.XhPage;
import com.xh.core.constant.AjaxResultConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 课堂互动点评(TsClassInteractiveCommon)表控制层
 *
 * @author Pitt Cheung
 * @since 2021-07-09 14:12:33
 */
@Api(tags="课堂互动接口")
@RestController
@RequestMapping("/classInteractiveCommon")
public class ClassInteractiveCommonController {
    /**
     * 服务对象
     */
    @Autowired
    private ClassInteractiveCommonService classInteractiveCommonService;
    @Autowired
    private ClassInteractiveCommonIconService classInteractiveCommonIconService;

    @ApiOperation("分页查询")
    @RequestMapping("/queryPage")
    public AjaxResult queryPage(XhPage page, QueryClassInteractiveCommonRequest request) {
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS, classInteractiveCommonService.queryPage(page, request));
    }

    @ApiOperation("新增")
    @RequestMapping("/add")
    public AjaxResult add(ClassInteractiveCommon classInteractiveCommon) {
        return new AjaxResult(classInteractiveCommonService.add(classInteractiveCommon));
    }

    @ApiOperation("修改")
    @RequestMapping("/modify")
    public AjaxResult modify(ClassInteractiveCommon classInteractiveCommon) {
        return new AjaxResult(classInteractiveCommonService.modify(classInteractiveCommon));
    }

    @ApiOperation("删除")
    @RequestMapping("/deleteByIds")
    public AjaxResult deleteByIds(String[] ids) {
        return new AjaxResult(classInteractiveCommonService.deleteByIds(ids));
    }

    @ApiOperation("查询所有图标")
    @RequestMapping("/queryAllIcon")
    public AjaxResult queryAllIcon() {
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS, classInteractiveCommonIconService.queryAll());

    }

    @ApiOperation("查询所有图标")
    @RequestMapping("/batchUpdateStatus")
    public AjaxResult batchUpdateStatus(String[] ids, Integer status) {
        classInteractiveCommonService.batchUpdateStatus(ids, status);
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }
}
